#include <iostream>

int
main()
{
  // a pointer to
  // (1) a character
  char c = 'a';
  char* p_c;
  p_c = &c;
  std::cerr << "*p_c = " << *p_c << std::endl;

  // (2) an array of 10 integers
  int vec[10] = { 1, 2, 3, 4, 5, 6, 7, 8, 9, 10 };
  int* p_vec = vec;
  std::cerr << "vec[4] = " << *(p_vec + 4) << std::endl;

  // (3) an array of character string
  char cs[6] = {'a', 'b', 'c', 'd', 'e', 'f'};
  char* p_cs = cs;
  std::cerr << "cs[1] = " << *(p_cs + 1) << std::endl;

  // (4) a pointer of character
  char** pp_c;
  pp_c = &p_c;
  std::cerr << "**pp_c = " << **pp_c << std::endl;

  // a constant integer
  const int ci = 6;
  
  // a pointer to a constant integer
  const int* p_ci;
  p_ci = &ci;
  std::cerr << "*p_ci = " << *p_ci << std::endl;

  // ERROR: increment of read-only location
  // (*p_ci)++; 

  int* const cp_i = &vec[3];
  std::cerr << "*cp_i = " << *cp_i << std::endl;
  ++(*cp_i);
  std::cerr << "*cp_i = " << *cp_i << std::endl;

  // ERROR: increment of read-only variable ‘cp_i’
  // ++cp_i;
}
